CREATE TABLE VPI.EXTRACT_BATCH_FLEX_VAR
(
	BATCH_ID	NUMBER(9)		NOT NULL,
	VAR_NAME	VARCHAR2(32)	NOT NULL,

	VAR$DATE	DATE,
	VAR$NUM		NUMBER,
	VAR$STR		VARCHAR2(64),

	CONSTRAINT PK_EXTRACT_BATCH_FLEX_VAR PRIMARY KEY (BATCH_ID, VAR_NAME),
	CONSTRAINT FK_EXTRACT_BATCH_FLEX_VAR FOREIGN KEY (BATCH_ID) REFERENCES VPI.EXTRACT_BATCH (BATCH_ID) ON DELETE CASCADE
);

COMMENT ON TABLE VPI.EXTRACT_BATCH_FLEX_VAR
	IS '(Optional) variables addition to EXTRACT_BATCH.';

COMMENT ON COLUMN VPI.EXTRACT_BATCH_FLEX_VAR.VAR_NAME
	IS 'The variable name';
COMMENT ON COLUMN VPI.EXTRACT_BATCH_FLEX_VAR.VAR$DATE
	IS 'Use this column if the variable is compatible with DATE type.';
COMMENT ON COLUMN VPI.EXTRACT_BATCH_FLEX_VAR.VAR$NUM
	IS 'Use this column if the variable is compatible with NUMBER type.';
COMMENT ON COLUMN VPI.EXTRACT_BATCH_FLEX_VAR.VAR$STR
	IS 'Use this column if the variable is compatible with STRING type.';
